<?php
/**
 * Created by PhpStorm.
 * User: 。。
 * Date: 2021/12/5
 * Time: 20:26
 */
echo'头像上传成功！';
echo'<br />';
print_r($_FILES);
echo'<br />';

function diao(){
    if(is_array($_FILES['file']['name'])){
        $count=count($_FILES['file']['name']);
        for($i=0;$i<$count;$i++){
            move_uploaded_file($_FILES['file']['tmp_name'][$i],'img/'.$_FILES['file']['name'][$i]);
            echo '上传的文件名'.$_FILES['file']['name'][$i].'<br />';
            echo '上传的临时文件名'.$_FILES['file']['tmp_name'][$i].'<br />';
        }
    }else{
        move_uploaded_file($_FILES['file']['tmp_name'],'img/'.$_FILES['file']['name']);
    }
}
diao();